-- GENERATED SPELL FOR [Cenarion Caretaker] --


function spell0_4050(pUnit, Event) --@Bear Form,Self--
pUnit:FullCastSpellOnTarget(7090,pUnit)
pUnit:RegisterEvent('Sorts_4050', 0, 1)
end

function spell1_4050(pUnit, Event) --@Maul,n/a--
pUnit:FullCastSpellOnTarget(12161,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_4050', 526, 1)
end

function spell2_4050(pUnit, Event) --@Thorns,n/a--
pUnit:FullCastSpellOnTarget(782,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_4050', 591, 1)
end

function Sorts_4050(pUnit, Event)
local choix_sorts_4050 = math.random(0, 2)
if choix_sorts_4050 == 0 then
pUnit:RegisterEvent('spell0_4050', 1, 1)
end
if choix_sorts_4050 == 1 then
pUnit:RegisterEvent('spell1_4050', 1, 1)
end
if choix_sorts_4050 == 2 then
pUnit:RegisterEvent('spell2_4050', 1, 1)
end
end

function mob4050_Action(pUnit, Event)
pUnit:RegisterEvent('Sorts_4050', math.random(1500, 3000), 1)
end

function mob4050_Leave(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob4050_Kill(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob4050_Die(pUnit, Event)
pUnit:RemoveEvents();
end

RegisterUnitEvent(4050, 1, 'mob4050_Action')
RegisterUnitEvent(4050, 2, 'mob4050_Leave')
RegisterUnitEvent(4050, 3, 'mob4050_Kill')
RegisterUnitEvent(4050, 4, 'mob4050_Die')
